Skip to content

Conversation

tobiaheg
Copy link
Member

Summary

Replaces plaintext password storage with salted scrypt hashes. New accounts and seeded users automatically receive hashed passwords, and login verifies the supplied password against the stored hash.

  • Uses a unique random salt per password and timing-safe hash comparison.
  • Adds npm run db-hash-passwords to convert existing plaintext passwords without changing users’ credentials. The script skips existing hashes and can safely be rerun.
  • Adds migration instructions and clearer database error messages.

Testing

Four automated tests pass, covering registration, login, unique salts, incorrect passwords, and rejection of plaintext or malformed hashes.

Full TypeScript checking remains blocked by existing project configuration/type errors. Database integration tests were not run.

Before running the updated backend

Stop the backend, ensure PostgreSQL is running, and run this from the backend directory:

npm run db-hash-passwords

Restart the backend after successful conversion. Existing accounts cannot log in until their stored passwords have been converted.

Closes #80

@tobiaheg tobiaheg added the enhancement New feature or request label Nov 10, 2026
@tobiaheg tobiaheg added this to the Delivery four milestone Nov 10, 2026
@tobiaheg tobiaheg requested a review from kfmelen November 10, 2026 11:52
@tobiaheg tobiaheg self-assigned this Nov 10, 2026
@tobiaheg tobiaheg requested a review from a team as a code owner November 10, 2026 11:52
@tobiaheg tobiaheg linked an issue Nov 10, 2026 that may be closed by this pull request
@kfmelen kfmelen changed the title 80 fix passwordhandling Fix passwordhandling Nov 10, 2026
Copy link
Member

@kfmelen kfmelen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@tobiaheg tobiaheg merged commit 3acdd3a into main Nov 10, 2026
@tobiaheg tobiaheg deleted the 80-fix-passwordhandling branch November 10, 2026 11:58
Sign in to join this conversation on GitHub.
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Fix passwordhandling
2 participants